#!/usr/bin/python
# -*- coding: UTF-8 -*-

print """ 字典是另一种可变容器模型，且可存储任意类型对象。

字典的每个键值 key=>value 对用冒号 : 分割，每个键值对之间用逗号 , 分割，整个字典包括在花括号 {} 中 ,格式如下所示：
"""

d = {"key1" : "value1", "key2" : "value2" }

print d

print "========================================"
print "访问字典里的值"

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'};

print "dict['Name']: ", dict['Name'];
print "dict['Age']: ", dict['Age'];

print "========================================"
print "修改字典"

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'};
print dict;
dict['Age'] = 8; # update existing entry
dict['School'] = "DPS School"; # Add new entry


print "dict['Age']: ", dict['Age'];
print "dict['School']: ", dict['School'];
print dict;

print "========================================"
print "删除字典元素"
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'};

del dict['Name']; # 删除键是'Name'的条目
print dict;
dict.clear();     # 清空词典所有条目

print dict;

del dict ;        # 删除词典

# print "dict['Age']: ", dict['Age'];
# print "dict['School']: ", dict['School'];